function result = j_permutate(n, N)

subblock_interleaver_pattern = [0, 1, 2, 4, ...
    3, 5, 6, 7, ...
    8, 16, 9, 17, ...
    10, 18, 11, 19, ...
    12, 20, 13, 21, ...
    14, 22, 15, 23, ...
    24, 25, 26, 28, ...
    27, 29, 30, 31];

ii = floor(32 * n / N);

result = subblock_interleaver_pattern(ii+1) * N/32 + mod(n, N/32);

end